<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>邀请用户界面</title>
    <script type="text/javascript" th:src="@{/jquery/jquery-3.5.1.min.js}"></script>
    <script th:src="@{/layui/layui.js}"></script>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
</head>
<body>
[[${tid}]]

<form class="layui-form layui-form-pane">
    <h3>邀请用户</h3>
    <input type="hidden" id="tid" name="tenantid" th:value="${tid}">
    <input class="layui-text" id="uname" type="text" name="username" placeholder="邀请个大牛来"><br>
    <input class="layui-btn-sm layui-btn-normal" type="button" value="邀请" onclick="a1()">
    <input class="layui-btn-sm" type="button" value="取消" id="close">
</form>

<script>
    var layer ;
    layui.use('layer', function(){
        layer = layui.layer;
    });
    $('#close').click(function (){
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    })
    // 监听提交,
    // form.on('submit(add)',function (data) {
    //     var index = parent.layer.getFrameIndex(window.name);
    //     $.post('/function/invitation',data.field,function (data) {
    //         parent.layer.msg(data.msg);
    //         if (data.flat){
    //             parent.layer.close(index)
    //         }
    //     })
    // })

    function a1(){
        $.post({
            url:"/function/invitation",
            data:{'username':$("#uname").val(),'tenantid':$('#tid').val()},
            success:function (data) {
                alert(data.toString());
            }
        });
    }
    
</script>

</body>
</html>